local sk__wanrou = fk.CreateSkill {

  name = "sk__wanrou",

  tags = {  },

}



sk__wanrou:addEffect(fk.AfterCardsMove, {
  name = "sk__wanrou",
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(sk__wanrou.name) then
      for _, move in ipairs(data) do
        if move.from == player then
          if move.toArea == Card.DiscardPile then
            for _, info in ipairs(move.moveInfo) do
              if (info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip) and
                Fk:getCardById(info.cardId).suit == Card.Diamond then
                return true
              end
              if info.fromArea == Card.PlayerJudge then
                return true
              end
            end
          elseif move.toArea == Card.Processing then
            for _, info in ipairs(move.moveInfo) do
              if info.fromArea == Card.PlayerJudge then
                return true
              end
            end
          end
        end
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local to = room:askForChoosePlayers(player, table.map(room.alive_players, Util.IdMapper), 1, 1,
      "#sk__wanrou-choose", sk__wanrou.name, true)
    if #to > 0 then
      event:setCostData(self, to[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:getPlayerById(event:getCostData(self)):drawCards(1, sk__wanrou.name)
  end,
})

return sk__wanrou